import Vue from "vue";
import Vuex from './vuexstate'

Vue.use(Vuex)
export  default new Vuex.Store({
  state:{
    msg:'梁又文',
    age:'20',
    number:23
  },
  mutations:{
    changeMsg(state,payload){
      state.msg=payload
    },
    changeAgeFn(state,payload){
      state.age=payload
    },
    changeGettersFn(state,payload){
      state.number+=payload
    }
  },
  actions:{
    changeAge(ctx,payload){
      ctx.commit('changeAgeFn',payload)
    }
  },
  getters:{
    changeGetters(state){
      return state.number+1
    }
  }
})
